#pragma once

/*
@author: TriLVH
@description: factory to create obstruction data by type
*/

#define _OBS_GRASS_1_HEIGHT 26
#define _OBS_GRASS_1_WIDTH  64

#define _OBS_WATER_1_HEIGHT 26
#define _OBS_WATER_1_WIDTH 64

#define _OBS_BRIDGE_LEFT_1_WIDTH 54
#define _OBS_BRIDGE_RIGHT_1_WIDTH 74
#define _OBS_BRIDGE_CENTER_1_WIDTH 64
#define _OBS_BRIDGE_1_HEIGHT 62

#include "CustomDefine.h"
#include "Utils.h"

class ObstructionDataFactory {
public: 
	/* Get obstruction rectangle bound- */
	static Rect* getRect(int type, double x, double y) {
		switch (type)
		{
		case _TYPE_OBS_GRASS_1:
			return new Rect(x, y, _OBS_GRASS_1_HEIGHT, _OBS_GRASS_1_WIDTH);
		case _TYPE_OBS_WATER_1:
			return new Rect(x, y, _OBS_WATER_1_HEIGHT, _OBS_WATER_1_WIDTH);
		case _TYPE_OBS_BRIDGE_LEFT_1:
			return new Rect(x, y, _OBS_BRIDGE_LEFT_1_WIDTH, _OBS_BRIDGE_1_HEIGHT);
		default:
			return new Rect(x, y, _OBS_GRASS_1_HEIGHT, _OBS_GRASS_1_WIDTH);
		}
	}

	/* Get obstruction sprite id from type */
	static int getSpriteId(int type) {
		switch (type)
		{
		case _TYPE_OBS_GRASS_1:
			return  _ID_MAP_STAGE1_GRASS_1;
		case _TYPE_OBS_WATER_1:
			return _ID_MAP_STAGE1_WATER_1;
		case _TYPE_OBS_BRIDGE_LEFT_1:
			return _ID_MAP_STAGE1_BRIDGE_LEFT_1;
		case _TYPE_OBS_BRIDGE_CENTER_1:
			return _ID_MAP_STAGE1_BRIDGE_CENTER_1;
		case _TYPE_OBS_BRIDGE_RIGHT_1:
			return _ID_MAP_STAGE1_BRIDGE_RIGHT_1;
		default:
			return _ID_MAP_STAGE1_GRASS_1;
		}
	}
};